import logging
from redis import StrictRedis

class Config:
    LOG_LEVEL = logging.DEBUG

    SECRET_KEY = 'b3aWkDnlhawKJ8isVC8J/8SHdT8wkOl5rU3kz3nSps6/ModoOC8QMVkxtvj0Uw0c6'
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:renhaoranrhr94@localhost:3306/book_store?charset=utf8'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    SESSION_TYPE = 'redis'
    SESSION_USE_SIGNER = True
    REDIS_HOST = 'localhost'
    REDIS_PORT = 6379

    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_PERMANENT = False
    PERMANENT_SESSION_LIFETIME = 86400 * 2


class DevelopmentConfig(Config):
    DEBUG=True



class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.WARNING

class TestingConfig(Config):
    DEBUG = True
    TESTING = True


configs = {
    'development':DevelopmentConfig,
    'production':ProductionConfig,
    'testing':TestingConfig

}